<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <link rel="stylesheet" href="../../css/style.css">
    <title>处理退货</title>
    <style>
        .step{width: 98%;position: relative;height: 100px;}
          .pathall{position: absolute;width: 65%;height: 20%;background-color: #dddddd;top:63%;left:12%;}
       .stepDiv{position: relative; width:90%;top:38%;left:5%;}
        .divBox{position: absolute;z-index: 999;width: 47px;height: 47px}
        .stepSuccess{width: 42px;height: 42px;border: 5px solid #dddddd;background-color: #dddddd;border-radius: 21px;}
         .step div{display: inline-block;}
        .divBox span{color: #06b30f;font-size: 16px;width:250%;margin-left: -15px;float: left;position: absolute;top: -43%;left: -12%; }
        .greenColor {background-color:#06b30f; }
        .refundPay{padding:10px;margin: 10px 100px;}
        .refundPay li{list-style-type: none;padding:20px;border-bottom: 1px dashed #dddddd;}
        .form-group{margin-left: 100px;margin-top:10px;}
        .submitBtn{width: 300px;margin: 0 auto; }
        .submitBtn button{margin: 10px;}
        ul li{list-style-type: none;}
        .goodsInfo li{display: inline-block;}
        .colors{background-color: #06b30f !important;}
       .hide{display: none;}
       .handleOpinions {margin-left: 120px;}
       .describe{position: absolute;width: 200px;}
       .bgRed{background-color: #fc0a0a !important;}
       .colorRed{color: #fc0a0a !important;}
       .examine label{padding: 5px;}
       .more1,.more2{position:relative;}
       .down1,.down2{position: absolute;width: 460px;height: 80px;border: 1px solid #dddddd;background-color: #fff;}
       .down1 ul li,.down2 ul li{padding: 5px;}

    </style>

</head>
<body>

    <div class="configNav"></div>
    <!-- content -->
    <div class="container-fluid">
        <div class="row">
            <!-- left -->
            <div class="col-md-2">
                <div class="list-group">
                    <a href="ass_refund.html" class="list-group-item">退款记录</a>
                    <a href="ass_returngoods.html" class="list-group-item  active">退货记录</a>
                </div>
            </div>
            <!-- right -->
            <div class="col-md-10">
                    <ol class="breadcrumb">
                            <li><a href="">商家管理中心</a></li>
                            <li><a href="">售后服务</a></li>
                            <li class="active"><a href="">退款记录</a></li>
                    </ol>

                   <table class="table table-bordered">
                        <tbody class="OrderRefundInfo">

                        </tbody>
                   </table>
           </div>


            </div>
        </div>
    </div>

    <script src="../../js/jquery.min.js" charset="utf-8"></script>
    <script src="../../js/bootstrap.min.js" charset="utf-8"></script>
     <script src="../../plugin/layer/layer.js" charset="utf-8"></script>
    <script src="../../plugin/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js" charset="utf-8"></script>
    <script src="../../plugin/bootstrap-datetimepicker/js/bootstrap-datetimepicker.zh-CN.js" charset="utf-8"></script>
    <script src="../../plugin/wangEditor/release/wangEditor.min.js" charset="utf-8"></script>
    <script src="../../js/nav.js" charset="utf-8"></script>
    <script src="../../js/common.js" charset="utf-8"></script>
    <script src="../../js/bootstrap-paginator.js" charset="utf-8"></script>
    <script src="../../js/ajax.js" charset="utf-8"></script>
   <script>

       $(document).ready(function(){
        getOrderRefundInfo()
           })

       var id = window.location.href.split('=')[1];//记录Id
           //数据渲染
       function getOrderRefundInfo(moni){
        var pageUrls=cncbk_common_tools.serverURL + '/aftersales/store/getOrderRefundInfo';
           var data0={'id':id}
           var funs= function(res){
            $('.OrderRefundInfo').empty();
            var html ='';
            var colors1='',submit='',colors2='',colors3='',colors4='',Hide='',refundAudit='',handleOpinions='',Opinions1='',Opinions2='',Opinions3='',Opinions4='',refundAuditPT='',colorRed='',HideBTN='';

            switch(Number(res.data.auditStatus)){
                case 1:
                colors1 ='colors';
                Opinions1='买家退货申请';
                submit='one';
                break;
                case 2:
                colors1 = colors2 ='bgRed';
                colorRed='colorRed'
                Opinions1='买家退货申请';
                Opinions2='审核未通过';
                Hide = 'hide';
                HideBTN='hide';
                handleOpinions='<span class="handleOpinions">处理状态：<span>未通过</span></span><br><span class="handleOpinions">商家备注：<span>'+  res.data.auditOpinion+'</span></span>'
                break;
                case 3:
                colors1  =colors2 = colors3='colors';
                submit='three';
                Opinions1='买家退货申请';
                Opinions2='审核通过';
                Opinions3='等待买家发货';
                Hide = 'hide';
                handleOpinions='<span class="handleOpinions">处理状态：<span>'+  res.data.auditStatus+'</span></span><br><span class="handleOpinions">商家备注：<span>'+  res.data.auditOpinion+'</span></span>'
                refundAudit='<tr><th><h5>商家收货审核</h5></th></tr><tr><td><div class="form-group handleOpinions"><label for="yes">是否已收货：</label><input type="radio" name="receiptGoods"  value="1">已收货<br><label style="vertical-align: top;">备注信息：</label><textarea name="receiptGO" id="auditOpinion" cols="50" rows="3"></textarea></div></td></tr>';
                    if (res.data.confirmGoods==1) {
                        colors1  =colors2 = colors3=colors4='colors';
                        Opinions2='审核通过';
                        Opinions3='商家已确认收货';
                        Opinions4='等待平台审核';
                        HideBTN='hide';
                        refundAudit='<tr><th><h5>商家收货审核</h5></th></tr><tr><td ><span class="handleOpinions">是否收货：'+  res.data.confirmGoods+'</span><br><span class="handleOpinions">商家收货备注信息:'+  res.data.confirmBz+'</span></td></tr>';
                        refundAuditPT='<tr><th><h5>平台处理状态</h5></th></tr><tr><td><span class="handleOpinions">平台确认：<span>'+  res.data.status+'</span></span></td></tr>';
                }
                break;
                case 4:
                colors1  =colors2 = colors3='colors';
                Opinions2='审核通过';
                Opinions1='买家退款申请';
                Opinions3='已弃货';
                handleOpinions='<span class="handleOpinions">处理状态：<span>'+  res.data.auditStatus+'</span></span><br><span class="handleOpinions">商家备注：<span>'+  res.data.auditOpinion+'</span></span>'
                Hide = 'hide';
                HideBTN='hide';
                break;
            }
            if (moni) {
                switch(res.data.status){
                    case "未退款":
                    colors1  =colors2 = colors3=colors4='colors';
                    Opinions2='审核通过';
                    Opinions3='商家已确认收货';
                    Opinions4='等待平台审核';
                    HideBTN='hide';
                    refundAudit='<tr><th><h5>商家收货审核</h5></th></tr><tr><td class="handleOpinions"><span style="margin-left:50px;">是否收货：'+  res.data.confirmGoods+'</span><br><spanstyle="margin-left:50px;">商家收货备注信息:'+  res.data.confirmBz+'</span></td></tr>';
                    refundAuditPT='<tr><th><h5>平台处理状态</h5></th></tr><tr><td><span class="handleOpinions">平台确认：<span>'+  res.data.status+'</span></span></td></tr>';
                    break;
                    case "已退款":
                    colors1  =colors2 = colors3=colors4='colors';
                    HideBTN='hide';
                    Opinions3='商家已确认收货';
                    Opinions4='平台已退款，交易完成';
                    refundAuditPT='<tr><th><h5>平台处理状态</h5></th></tr><tr><td><span class="handleOpinions">平台确认：<span>'+  res.data.status+'</span></span></td></tr>';
                    break;
                }
            }

            html +='<tr>'+
                '<td class="col-md-7">'+
                '<table class="table table-bordered">'+
                '<thead >'+
                '<tr>'+
                '<th><h5>退货服务</h5></th>'+
                '</tr>'+
                '<tr>'+
                '<td>'+
               	'<div class="step">'+
               	'<div class="pathall"></div>'+
				'<div class="stepDiv" >'+
				'<div class="divBox " style="left:6%;top:38%;">'+
				'<span class="describe '+colorRed+'">'+Opinions1+'</span>'+
				'<div class="stepSuccess '+colors1+'"></div>'+
				'</div>'+
				'<div class="divBox" style="left:28%;top:38%;">'+
				'<span class="describe '+colorRed+'">'+Opinions2+'</span>'+
				'<div class="stepSuccess '+colors2+'"></div>'+
				'</div>'+
				'<div class="divBox" style="left:50%;top:38%;">'+
				'<span class="describe ">'+Opinions3+'</span>'+
				'<div class="stepSuccess '+colors3+'"></div>'+
				'</div>'+
				'<div class="divBox" style="left:76%;top:38%;">'+
				'<span class="describe">'+Opinions4+'</span>'+
				'<div class="stepSuccess '+colors4+'"></div>'+
				'</div>'+
				'</div>'+
				'</div>'+
                '</td>'+
                '</tr>'+
                '</thead>'+
                '<tbody>'+
                '<tr>'+
                '<th><h5>买家退货申请</h5></th>'+
                '</tr>'+
                '<tr>'+
                '<td>'+
                '<ul class="refundPay">'+
                '<li>退货编号：<span>'+ res.data.refundSn+'</span></li>'+
                '<li>申请人（买家）：<span>'+ res.data.buyerName+'</span></li>'+
                '<li>退货原因：<span>'+ res.data.reason+'</span></li>'+
                '<li>退货金额：<span>'+ res.data.refundAmount+'</span></li>'+
                '<li>退货说明：<span>'+ res.data.description+'</span></li>'+
                '</ul>'+
                '</td>'+
                '</tr>'+
                '<tfooter>'+
                '<tr>'+
                '<th><h5>商家处理意见</h5></th>'+
                '</tr>'+
                '<tr>'+
                '<td >'+
                handleOpinions+
                '<div class="form-group examine '+Hide+'" >'+
                '是否同意：'+
                '<label for="">'+
                '<input type="radio" name="status" id="yes" value="3">同意'+
                '<label>'+
                '<label for="">'+
                '<input type="radio" name="status" id="no" value="2">拒绝'+
                '<label>'+
                '<label for="">'+
                '<input type="radio" name="status" id="jettison" value="4">弃货'+
                '<label>'+
                    '<span>如果选择弃货，买家将不用退回原商品，提交后直接由管理员确认退款</span>'+
                '</div>'+

                '<div class="form-group  '+Hide+'">'+
                '<label style="vertical-align: top;">备注信息：</label>'+
                '<textarea name="opinion" id="auditOpinion" cols="50" rows="5"></textarea>'+
                '<p>'+
                '<span>只能提交一次，请认真选择。</span><br>'+
                '<span>同意并经过平台确认后会将金额以预存款的形式返还给买家。</span><br>'+
                '<span>不同意时买家可以向平台投诉或再次申请。</span>'+
                '</p>'+
                '</div>'+
                '</td>'+
                '</tr>'+
                refundAudit+
                refundAuditPT+
                '<tr>'+
                '<td>'+
                '<div class="submitBtn">'+
                '<button class="btn btn-success '+submit+' '+HideBTN+'"  refundId="'+  res.data.refundId+'">确定</button>'+
                '<button class="btn btn-success backList">返回列表</button>'+
                '</div>'+
                '</td>'+
                '</tr>'+
                '</tfooter>'+
                '</tbody>'+
                '</table>'+
                '</td>'+
                '<td class="col-md-4">'+
                '<table class="table table-bordered">'+
                '<tbody>'+
                '<tr>'+
                '<th><h5>相关商品交易信息</h5></th>'+
                '</tr>'+
                '<tr>'+
                '<td>'+
                '<span>运费：<span>'+ res.data.goodsFreight+'</span></span><br>'+
                '<span>订单总额：<span>'+ res.data.goodsAmount+'</span></span>'+
                '</td>'+
                '</tr>'+
                '<tr>'+
                '<td>'+
                '<span>订单编号：<span>'+ res.data.orderSn+'</span></span>'+
                '<span  style="float:right;" class="more1">更多<i class="glyphicon glyphicon-chevron-down"></i></span>'+
                '<div class="down1" style="display:none;">'+
                '<ul>'+
                '<li>支付方式：<span>'+ res.data.paymentCode+'</span></li>'+
                '<li>下单时间：<span>'+ res.data.orderTime+'</span></li>'+
                '</ul>'+
                '</div>'+
                '</td>'+
                '</tr>'+
                '<tr>'+
                '<td>'+
                '<span>收货人：<span>'+ res.data.province+ res.data.city+ res.data.country+ res.data.town+ res.data.auditStatus+'</span></span>'+
                '<span style="float:right;" class="more2">更多<i class="glyphicon glyphicon-chevron-down"></i></span>'+
                '<div class="down2" style="display:none;">'+
                '<ul>'+
                '<li>收货地址：<span>'+ res.data.name+'</span></li>'+
                '<li>联系电话：<span>'+ res.data.phone+'</span></li>'+
                '</ul>'+
                '</div>'+
                '</td>'+
                '</tr>'+
                '</tbody>'+
                '</table>'+
                '</td>'+
                '</tr>';
                $('.OrderRefundInfo').append(html);

                    //悬停显示更多
                    $('.more1').mouseenter(function(){
                        $('.down1').show();
                    }).mouseleave(function(){
                        $('.down1').hide();
                    })
                    $('.more2').mouseenter(function(){
                        $('.down2').show();
                    }).mouseleave(function(){
                        $('.down2').hide();
                    })

                    //同意退货接口
                    $('.one').click(function(){
                        var pageUrls=cncbk_common_tools.serverURL + '/aftersales/store/auditOrderRefund';
                        var refundId = $(this).attr('refundId');
                        var opinion = $(" [name='opinion']").val();
                        var status =  $(" [name='status']:checked").val();
                        var data1={'refundId':refundId,'status':status,'opinion':opinion}
                        var func = function (res){
                            if (res.code==200) {
                                getOrderRefundInfo();
                            }
                        }
                        ajax(
                            pageUrls,
                            data1,
                            func,
                            'post',
                            'json'
                        )
                    })


                  //确认收货接口
                        $('.three').click(function(){
                        var pageUrls=cncbk_common_tools.serverURL + '/aftersales/store/confirmGoods';
                        var refundId = $(this).attr('refundId');
                        var confirmBz = $(" [name='receiptGO']").val();
                        var confirmGoods =  $(" [name='receiptGoods']:checked").val();
                        var data={'refundId':refundId,'confirmGoods':confirmGoods,'confirmBz':confirmBz}
                        var funthree = function(res){

                            if (res.code==200) {
                                getOrderRefundInfo(confirmGoods)
                            }
                        }
                        ajax(
                            pageUrls,
                            data,
                            funthree,
                            'post',
                            'json'
                        )
                    })



                    //返回列表
                    $('.backList').off('click').click(function(){
                        window.location.href = 'ass_returngoods.html';
                    })
           }
           ajax(
               pageUrls,
               data0,
               funs,
               'post',
               'json'
           )
       }
   </script>

</body>
</html>
